package cn.binarywang.tools.generator.event;

/**
 * 枚举: 系统内置事件
 * @author
 */
public enum SysEventEnum {
    /**  未知  */
    _unknown("", "未知"),
    label_add("label_add", "新增用户标签事件");

    private String name;
    private String text;

    SysEventEnum(String name, String text) {
        this.name = name;
        this.text = text;
    }

    public static SysEventEnum get(String name, boolean ifDefaultValue) {
        if (name == null) {
            return ifDefaultValue ? _unknown : null;
        }

        SysEventEnum[] elements = SysEventEnum.values();
        for (SysEventEnum element : elements) {
            if (element.getName().equals(name)) {
                return element;
            }
        }

        return ifDefaultValue ? _unknown : null;
    }

    public static String getText(String name) {
        return get(name, true).getText();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
